package com.zj.joke.db;

/**
 * Created by zhangjian on 13-12-6.
 */

import com.activeandroid.Model;
import com.activeandroid.annotation.Column;
import com.activeandroid.annotation.Table;
import com.activeandroid.query.From;
import com.activeandroid.query.Select;

import java.util.List;

@Table(name = "DBCategory")
public class DBCategory extends Model {

	@Column(name = "category")
	public String category;

	@Column(name = "count")
	public long count;

	@Column(name = "unreadnum")
	public long unreadnum;

	@Column(name = "image_id")
	public int image_id;

	@Column(name = "url")
	public String url;

	public static long getDBCategoryItemSize(String paramString) {
		From localFrom = new Select().from(DBCategory.class);
		Object[] arrayOfObject = new Object[1];
		arrayOfObject[0] = paramString;
		return localFrom.where("category = ?", arrayOfObject).execute().size();
	}

	public static int getDBCategorySize() {
		return new Select().from(DBCategory.class).execute().size();
	}

	public static List<DBCategory> getDBCategorys() {
		return new Select().from(DBCategory.class).execute();
	}
}